package org.thaonv;

public class WorkerThread extends Thread {

	private String command;

	public WorkerThread(String s){
		this.command=s;
	}

	@Override
	public void run() {
		System.out.println(Thread.currentThread().getName()+" Start. Command = "+command);
		processCommand();
		System.out.println(Thread.currentThread().getName()+" End.");
	}

	private void processCommand() {
		try {
			for(int i=0;i<5;i++){
				Thread.sleep(3000);
				System.out.println("Proccessing "+command);
			}
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
	}
	@Override
	public String toString(){
		return this.command;
	}
}
